<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "t_session".
 *
 * @property int $id ID
 * @property int $activityId 活动ID
 * @property string $name 场次名称
 * @property string $startDate 开始时间
 * @property string $endDate 结束时间
 * @property float $price 金额
 * @property int $performances 节目数量
 * @property int $status 状态(0:无效，1:有效)
 * @property int $_intm 创建时间
 */
class TSession extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 't_session';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['activityId', 'startDate', 'endDate'], 'required'],
            [['activityId', 'performances', 'status', '_intm'], 'integer'],
            [['startDate', 'endDate'], 'safe'],
            [['price'], 'number'],
            [['name'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'activityId' => '活动ID',
            'name' => '场次名称',
            'startDate' => '开始时间',
            'endDate' => '结束时间',
            'price' => '金额',
            'performances' => '节目数量',
            'status' => '状态(0:无效，1:有效)',
            '_intm' => '创建时间',
        ];
    }

    public function getActivity(){
        return $this->hasOne(TActivity::class, ['id' => 'activityId']);
    }
}
